package cn.mulanbay.api.system.service;

import cn.mulanbay.api.system.bean.RemoteMessageSearch;
import cn.mulanbay.api.system.config.FeignRequestInterceptor;
import cn.mulanbay.api.system.factory.RemoteMessageFallbackFactory;
import cn.mulanbay.business.bean.SysMessageBean;
import cn.mulanbay.business.bean.UserMessageBean;
import cn.mulanbay.common.bean.DataGrid;
import cn.mulanbay.common.config.ServiceNameConstants;
import cn.mulanbay.common.domain.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * 消息服务
 *
 * @author fenghong
 */
@FeignClient(contextId = "remoteMessageService",
        value = ServiceNameConstants.MESSAGE_SERVICE,
        fallbackFactory = RemoteMessageFallbackFactory.class,
        configuration={FeignRequestInterceptor.class})
public interface RemoteMessageService {

    /**
     * 添加用户消息
     *
     * @param umb 用户消息信息
     * @return 结果
     */
    @PostMapping("/userMessage/addUserMsg")
    public R<Boolean> addUserMsg(@RequestBody UserMessageBean umb);

    /**
     * 添加系统消息
     *
     * @param smb 消息消息信息
     * @return 结果
     */
    @PostMapping("/userMessage/addSysMsg")
    public R<Boolean> addSysMsg(@RequestBody SysMessageBean smb);

    /**
     * 消息查询
     *
     * @param rms 消息查询
     * @return 结果
     */
    @GetMapping("/userMessage/getData")
    public R<DataGrid> getData(@SpringQueryMap RemoteMessageSearch rms);

}
